import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

/*
 *@Student 张策
 */
public class CardGame {
    public static final String[] suits={"♥","♦","♠","♣"};
    public List<Card>buyCard(){
        List<Card> cards = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            for (int j = 1; j <= 13; j++) {
                cards.add(new Card(suits[i], j));
            }
        }
        return cards;
    }
    //打乱
    public void shuffle(List<Card>CardList){
        Random random=new Random();
        for (int i = CardList.size()-1; i>0; i--) {
            Collections.swap(CardList,i,random.nextInt(i));
        }
    }
//    private void swap(List<Card>list,int i,int x){
//        Card card=list.get(i);
//        list.set(i,list.get(x));
//        list.set(x,card);
//    }
    public List<List<Card>>Fplays(ArrayList<Card>cards){
        List<Card> play1 = new ArrayList<>();
        List<Card> play2 = new ArrayList<>();
        List<Card> play3 = new ArrayList<>();
        List<List<Card>> plays = new ArrayList<>();
        plays.add(play1);
        plays.add(play2);
        plays.add(play3);
        for (int i = 0; i <3; i++) {
            for (int j = 0; j < 5; j++) {
                plays.get(i).add(cards.get(j));
                cards.remove(0);
            }
        }
        return plays;
    }
}
